~ chicken-core (chicken-5) /manual/Module (chicken time posix)
Trap1[[tags: manual]]2[[toc:]]34== Module (chicken time posix)56This module provides procedures for conversion between seconds since7the epoch ("POSIX time"), strings and a 10-element vector type8containing the distinct time units.91011=== seconds->local-time1213<procedure>(seconds->local-time [SECONDS])</procedure>1415Breaks down the time value represented in {{SECONDS}} into a 1016element vector of the form {{#(seconds minutes hours mday month17year wday yday dstflag timezone)}}, in the following format:1819; seconds (0) : the number of seconds after the minute (0 - 59)20; minutes (1) : the number of minutes after the hour (0 - 59)21; hours (2) : the number of hours past midnight (0 - 23)22; mday (3) : the day of the month (1 - 31)23; month (4) : the number of months since january (0 - 11)24; year (5) : the number of years since 190025; wday (6) : the number of days since Sunday (0 - 6)26; yday (7) : the number of days since January 1 (0 - 365)27; dstflag (8) : a flag that is true if Daylight Saving Time is in effect at the time described.28; timezone (9) : the difference between UTC and the latest local standard time, in seconds west of UTC.2930{{SECONDS}} defaults to31the value of {{(current-seconds)}}.3233=== local-time->seconds3435<procedure>(local-time->seconds VECTOR)</procedure>3637Converts the ten-element vector {{VECTOR}} representing the time value relative to38the current timezone into39the number of seconds since the first of January, 1970 UTC.4041=== local-timezone-abbreviation4243<procedure>(local-timezone-abbreviation)</procedure>4445Returns the abbreviation for the local timezone as a string.4647=== seconds->string4849<procedure>(seconds->string [SECONDS])</procedure>5051Converts the time represented in {{SECONDS}} into a local-time string52of the form {{"Tue May 21 13:46:22 1991"}}. {{SECONDS}} defaults to53the value of {{(current-seconds)}}.5455=== seconds->utc-time5657<procedure>(seconds->utc-time [SECONDS])</procedure>5859Similar to {{seconds->local-time}}, but interpretes {{SECONDS}}60as UTC time. {{SECONDS}} defaults to61the value of {{(current-seconds)}}.6263=== utc-time->seconds6465<procedure>(utc-time->seconds VECTOR)</procedure>6667Converts the ten-element vector {{VECTOR}} representing the UTC time value into68the number of seconds since the first of January, 1970 UTC.6970'''NOTE''': On native Windows builds (all except cygwin), this71procedure is unimplemented and will raise an error.7273=== time->string7475<procedure>(time->string VECTOR [FORMAT])</procedure>7677Converts the broken down time represented in the 10 element vector78{{VECTOR}} into a string of the form represented by the {{FORMAT}}79string. The default time form produces something like {{"Tue May 21 13:46:22 1991"}}.8081The {{FORMAT}} string follows the rules for the C library procedure {{strftime}}. The default {{FORMAT}} string is {{"%a %b %e %H:%M:%S %Z %Y"}}.8283=== string->time8485<procedure>(string->time TIME [FORMAT])</procedure>8687Converts a string of the form represented by the {{FORMAT}} string88into the broken down time represented in a 10 element vector. The89default time form understands something like {{"Tue May 21 13:46:22 1991"}}.9091The {{FORMAT}} string follows the rules for the C library procedure {{strptime}}. The default {{FORMAT}} string is {{"%a %b %e %H:%M:%S %Z %Y"}}.929394---95Previous: [[Module (chicken time)]]9697Next: [[Module (chicken type)]]